package design_pattern.chain_of_responsibility;

/**
 * Created by WeiDingKuo on 2017/10/26 17:47
 * <p>
 * 具体节点
 */
public class HandlerImpl3 implements Handler {
    private Handler handler;

    public HandlerImpl3() {
    }

    public HandlerImpl3(Handler handler) {
        this.handler = handler;
    }

    @Override
    public void handleRequest(Request request) {
        if (request.getType() != null && request.getType().equals("c")) {
            //条件满足，当前节点处理
            System.out.println("request handle by " + this.getClass().getName());
        } else {
            //条件不满足，交给下一个节点处理
            handler.handleRequest(request);
        }
    }
}
